import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

import billDetail from '@/pages/members/myBill/billDetail/billDetail.vue'
import payforSuccess from '@/components/payforSuccess.vue'
import myLease from '@/pages/members/myLease/myLease.vue'
import myBill from '@/pages/members/myBill/myBill.vue'
import payforBill from '@/pages/members/payforBill/payforBill.vue'
import tuiRentBill from '@/pages/members/myBill/tuiRentBill/tuiRentBill.vue'

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/loginOpenid',
      name: 'loginOpenid',
      meta:{
        title:'正在登录...'
      },
      component: ()=> import ('@/pages/loginOpenid.vue')
    },
    {
      path: '/index',
      name: 'index',
      meta:{
        title:'随寓',
      },
      component: ()=> import ('@/pages/index/index.vue')
    },
    {
      path: '/login',
      name: 'login',
      meta:{
        title:'登录'
      },
      component: ()=> import ('@/pages/login/login.vue')
    },
    {
      path: '/cities',
      name: 'cities',
      meta:{
        title:'选择城市'
      },
      component: ()=> import ('@/pages/cities/cities.vue')
    },
    {
      path: '/houseList',
      name: 'houseList',
      meta:{
        title:'房源'
      },
      component: ()=> import ('@/pages/houseList/houseList.vue')
    },
    {
      path: '/shortHouselist',
      name: 'shortHouselist',
      meta:{
        title:'短租'
      },
      component: ()=> import ('@/pages/shortHouselist/shortHouselist.vue')
    },
    {
      path: '/searchPage',
      name: 'searchPage',
      meta:{
        title:'搜索'
      },
      component: ()=> import ('@/pages/searchPage/searchPage.vue')
    },
    {
      path: '/searchHouse',
      name: 'searchHouse',
      meta:{
        title:'房源'
      },
      component: ()=> import ('@/pages/searchHouse/searchHouse.vue')
    },
    {
      path: '/houseDetail',
      name: 'houseDetail',
      meta:{
        title:'房源详情'
      },
      component: ()=> import ('@/pages/houseDetail/houseDetail.vue')
    },
    {
      path: '/bigImg',
      name: 'bigImg',
      meta:{
        title:'房源相册'
      },
      component: ()=> import ('@/pages/houseDetail/template/bigImg.vue')
    },
    {
      path: '/reservation',
      name: 'reservation',
      meta:{
        title:'立即预约'
      },
      component: ()=> import ('@/pages/reservation/reservation.vue')
    },
    {
      path: '/signContact',
      name: 'signContact',
      meta:{
        title:'立即签约'
      },
      component: ()=> import ('@/pages/signContact/signContact.vue')
    },
    {
      path: '/members',
      name: 'members',
      meta:{
        title:'我的'
      },
      component: ()=> import ('@/pages/members/myCenter/myCenter.vue')
    },
    {
      path: '/memberSet',
      name: 'memberSet',
      meta:{
        title:'个人资料'
      },
      component: ()=> import ('@/pages/members/memberSet/memberSet.vue')
    },
    {
      path: '/changeName',
      name: 'changeName',
      meta:{
        title:'昵称'
      },
      component: ()=> import ('@/pages/members/memberSet/memberSetFile/changeName.vue')
    },
    {
      path: '/yzmCode',
      name: 'yzmCode',
      meta:{
        title:'验证码'
      },
      component: ()=> import ('@/pages/members/memberSet/memberSetFile/yzmCode.vue')
    },
    {
      path: '/newPhone',
      name: 'newPhone',
      meta:{
        title:'验证码'
      },
      component: ()=> import ('@/pages/members/memberSet/memberSetFile/newPhone.vue')
    },
    {
      path: '/changePhone',
      name: 'changePhone',
      meta:{
        title:'更换手机号码'
      },
      component: ()=> import ('@/pages/members/memberSet/memberSetFile/changePhone.vue')
    },
    {
      path: '/certification',
      name: 'certification',
      meta:{
        title:'实名认证'
      },
      component: ()=> import ('@/pages/members/memberSet/memberSetFile/certification.vue')
    },
    {
      path: '/myCollection',
      name: 'myCollection',
      meta:{
        title:'我的收藏'
      },
      component: ()=> import ('@/pages/members/myCollection/myCollection.vue')
    },
    {
      path: '/myIntroduce',
      name: 'myIntroduce',
      meta:{
        title:'我的推荐'
      },
      component: ()=> import ('@/pages/members/myIntroduce/myIntroduce.vue')
    },
    {
      path: '/introduceList',
      name: 'introduceList',
      meta:{
        title:'我的推荐'
      },
      component: ()=> import ('@/pages/members/myIntroduce/introduceList/introduceList.vue')
    },
    {
      path: '/orderList',
      name: 'orderList',
      meta:{
        title:'预约记录'
      },
      component: ()=> import ('@/pages/members/orderList/orderList.vue')
    },
    {
      path: '/myWallet',
      name: 'myWallet',
      meta:{
        title:'我的钱包'
      },
      component: ()=> import ('@/pages/members/myWallet/myWallet.vue')
    },
    {
      path: '/landlordWallet',
      name: 'landlordWallet',
      meta:{
        title:'房东钱包'
      },
      component: ()=> import ('@/pages/landlord/landlordWallet/landlordWallet.vue')
    },
    {
      path: '/balanceDetail',
      name: 'balanceDetail',
      meta:{
        title:'资金明细'
      },
      component: ()=> import ('@/pages/members/myWallet/balanceDetail/balanceDetail.vue')
    },
    {
      path: '/bankCards',
      name: 'bankCards',
      meta:{
        title:'我的银行卡'
      },
      component: ()=> import ('@/pages/members/myWallet/bankCards/bankCards.vue')
    },
    {
      path: '/chooseBank',
      name: 'chooseBank',
      meta:{
        title:'选择银行'
      },
      component: ()=> import ('@/pages/members/myWallet/bankCards/chooseBank.vue')
    },
    {
      path: '/addBankCard',
      name: 'addBankCard',
      meta:{
        title:'添加银行卡'
      },
      component: ()=> import ('@/pages/members/myWallet/bankCards/addBankCard.vue')
    },
    {
      path: '/editBankCard',
      name: 'editBankCard',
      meta:{
        title:'修改银行卡'
      },
      component: ()=> import ('@/pages/members/myWallet/bankCards/editBankCard.vue')
    },
    {
      path: '/tixian',
      name: 'tixian',
      meta:{
        title:'提现'
      },
      component: ()=> import ('@/pages/members/myWallet/tixian.vue')
    },
    {
      path: '/myLease',
      name: 'myLease',
      meta:{
        title:'我的租约'
      },
      component: myLease
    },
    {
      path: '/myBill',
      name: 'myBill',
      meta:{
        title:'我的账单'
      },
      component: myBill
    },
    {
      path: '/billDetail',
      name: 'billDetail',
      meta:{
        title:'账单详情'
      },
      //下面这种方式就是按需加载，按需加载偶尔会出现一些匪夷所思的问题.
      // component: ()=> import ('@/pages/members/myBill/billDetail/billDetail.vue')
      component: billDetail // 叶叶看这里！这种方式就是普通加载
    },
    {
      path: '/payforBill',
      name: 'payforBill',
      meta:{
        title:'支付'
      },
      component: payforBill
    },
    {
      path: '/payforSuccess',
      name: 'payforSuccess',
      meta:{
        title:'支付成功'
      },
      component: payforSuccess
    },
    {
      path: '/tuiRentBill',
      name: 'tuiRentBill',
      meta:{
        title:'退租账单'
      },
      component: tuiRentBill
    },
    {
      path: '/feedback',
      name: 'feedback',
      meta:{
        title:'意见反馈'
      },
      component: ()=> import ('@/pages/members/feedback/feedback.vue')
    },
    {
      path: '/smartLock',
      name: 'smartLock',
      meta:{
        title:'智能门锁'
      },
      component: ()=> import ('@/pages/members/smartLock/smartLock.vue')
    },
    {
      path: '/lockCode',
      name: 'lockCode',
      meta:{
        title:'智能门锁'
      },
      component: ()=> import ('@/pages/members/smartLock/lockCode/lockCode.vue')
    },
    {
      path: '/modifyLock',
      name: 'modifyLock',
      meta:{
        title:'修改密码'
      },
      component: ()=> import ('@/pages/members/smartLock/modifyLock.vue')
    },
    {
      path: '/temporaryLock',
      name: 'temporaryLock',
      meta:{
        title:'临时密码'
      },
      component: ()=> import ('@/pages/members/myLease/template/temporaryLock.vue')
    },
    {
      path: '/releaseHouse',
      name: 'releaseHouse',
      meta:{
        title:'发布房源'
      },
      component: ()=> import ('@/pages/releaseHouse/releaseHouse.vue')
    },
    {
      path: '/aMap',
      name: 'aMap',
      meta:{
        title:'地图'
      },
      component: ()=> import ('@/pages/houseAmap/aMap.vue')
    },
    {
      path: '/landlord',
      name: 'landlord',
      meta:{
        title:'我的'
      },
      component: ()=> import ('@/pages/landlord/landlord.vue')
    },
    {
      path: '/landlordHouseDetail',
      name: 'landlordHouseDetail',
      meta:{
        title:'房源详情'
      },
      component: ()=> import ('@/pages/landlord/landlordHouseDetail/landlordHouseDetail.vue')
    },
    {
      path: '/editHouse',
      name: 'editHouse',
      meta:{
        title:'编辑房源'
      },
      component: ()=> import ('@/pages/landlord/editHouse/editHouse.vue')
    },
    {
      path: '/contact',
      name: 'contact',
      meta:{
        title:'合同'
      },
      component: ()=> import ('@/pages/contact/contact.vue')
    },
    {
      path: '/calendar',
      name: 'calendar',
      meta:{
        title:'日历'
      },
      component: ()=> import ('@/pages/calendar/calendar.vue')
    },
    {
      path: '/houseAmap',
      name: 'houseAmap',
      meta:{
        title:'地址导航'
      },
      component: ()=> import ('@/pages/houseAmap/houseAmap.vue')
    },
  ],
  scrollBehavior (to, from, savedPosition) {
     if (savedPosition) {
      return savedPosition
     } else {
      return { x: 0, y: 0 }
     }
    }
})
